<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Find CustomerLocation</title>
    </head>
    <body>
        <c:import url="header.jsp"/>
        <c:if test="${not empty sessionScope.found_customerLocation}">
            <x:parse xml="${sessionScope.found_customerLocation}" var="customerLocations"/>
            <x:choose>
                <x:when select="$customerLocations/customerLocations/customerLocation">
                    <table border="1" cellpadding="5" style="border-collapse: collapse; border: 1px solid lightgray;">
                        <tr>
                            <td style="width: 100px; background: silver">ID</td>
                            <td style="width: 200px; background: silver">Название</td>
                            <td style="width: 200px; background: silver">Студия</td>
                            <td style="width: 100px; background: silver">Год</td>
                        </tr>
                        <x:forEach select="$customerLocations/customerLocations/customerLocation" var="item">
                        <tr>
                            <td><x:out select="$item/@id"/></td>
                            <td><a href="CustomerLocationServlet?type=update&id=<x:out select="$item/@id"/>"><x:out select="$item/@address"/></a></td>
                            <td><x:out select="$item/@customerId"/></td>
                        </tr>
                        </x:forEach>
                    </table>
                    <div style="height:  20px"></div>
                </x:when>
                <x:otherwise>
                    <p>No results</p>
                </x:otherwise>
            </x:choose>
        </c:if>
        <form action="SearchServlet">
            <input hidden="true" class="text" name="type" value="customerLocation"/>
            <input style="width: 300px; height: 18px" class="text" maxlength="16" type="text" name="name"/>
            <input class="button" type="submit" value="Search"/>
        </form>
        <c:remove scope="session" var="found_customerLocation"/>
    </body>
</html>
